using UnityEngine;
using System.Collections;

public class MouseReplace : MonoBehaviour {
	
	public Transform mouse;
	public PlayerAction playerAction;
	
	InputInfo inputInfo;
	Vector3 mouseLocation;
	//ClipAnimation clipAnimation;

	// Use this for initialization
	void Start () {
		inputInfo = Camera.main.GetComponent<InputInfo>();
		
		mouseLocation = mouse.position;
	}
	
	// Update is called once per frame
	void Update () {
		if(inputInfo.hasSingleTouch){
			mouse.gameObject.SetActive(true);
			mouseLocation.x = inputInfo.hit.point.x;
			mouseLocation.y = inputInfo.hit.point.y;
		} else {
			if(playerAction.IsIdling){
				mouse.gameObject.SetActive(false);
			}
		}
		
		mouse.position = mouseLocation;
	}

    public void setMousePos(Vector3 pos)
    {
        mouse.gameObject.SetActive(true);
        mouseLocation.x = pos.x;
        mouseLocation.y = pos.y;
        mouse.position = mouseLocation;
    }
}
